package com.ioidea.holland.commonBle

import androidx.lifecycle.MutableLiveData
import cn.com.heaton.blelibrary.ble.BleRssiDevice
import com.ioidea.base.view.BaseViewModel
import com.ioidea.holland.api.PhoneBleApi
import com.ioidea.ble.en.EnumBleStatus

open class CommonBleViewModel :BaseViewModel() {

    /**
     * 蓝牙状态
     */
    val liveDataBleStatus = MutableLiveData<EnumBleStatus>()

    fun setBleStatus(){
        PhoneBleApi.setBLeStatusListener{ enumBleStatus ->
            liveDataBleStatus.postValue(enumBleStatus)
        }
    }

    fun disconnect(device: BleRssiDevice){
        PhoneBleApi.disconnect(device)
    }

}